<template>
  <div>
    <div class="mt-30">
      <van-tabs type="card" color="#FD7753" @change="handleChange">
        <van-tab
          v-for="(item, index) in statusList"
          :key="index"
          :title="item.title"
        ></van-tab>
      </van-tabs>
      <div class="p-20 flex flex-wrap justify-between">
        <job-item
          v-for="(item, index) in joinList"
          :key="index"
          :jdata="item"
          is-hot
        />
      </div>
    </div>
  </div>
</template>

<script>
import { joinGet } from "@/api/user";

export default {
  data() {
    return {
      statusList: [
        { title: "全部", status: 0 },
        { title: "等待审核", status: 2 },
        { title: "预约面试", status: 3 },
        { title: "成功入职", status: 4 },
        { title: "已被拒绝", status: 5 },
      ],
      joinList: [],
    };
  },
  computed: {
    userId() {
      return this.$store.state.user.userInfo.objectId;
    },
  },
  created() {
    joinGet(this.userId, 0).then((res) => {
      console.log(res);
      this.joinList = res.data.results;
    });
  },
  methods: {
    handleChange(idx) {
      console.log(idx);
      let { status } = this.statusList[idx];
      joinGet(this.userId, status).then((res) => {
        // console.log(res);
        this.joinList = res.data.results;
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
